/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.bikerz.user.bike.service;

import br.com.bikerz.user.bike.dao.UserBikeDAO;
import br.com.bikerz.user.bike.domain.UserBike;
import java.util.List;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service("userBikeService")
public class UserBikeServiceImpl implements UserBikeService{

	private UserBikeDAO userBikeDAO;

	@Autowired
	public UserBikeServiceImpl(UserBikeDAO userBikeDAO) {
		this.userBikeDAO = userBikeDAO;
	}

	@Transactional
	public void createNew(UserBike userBike) {
		userBikeDAO.persist(userBike);
	}

	@Transactional(readOnly=true)
	public List<UserBike> findAll() {
		return userBikeDAO.loadAll();
	}

	@Transactional(readOnly=true)
	public List<UserBike> findByTitle(String title) {
		return userBikeDAO.findByTitle(title);
	}

	@Transactional
	public void update(UserBike userBike) {
		userBikeDAO.update(userBike);
	}

	@Transactional
	public void remove(UserBike userBike) {
		userBikeDAO.delete(userBike);
	}

	@Transactional(readOnly=true)
	public UserBike findById(Long id) {
		return userBikeDAO.loadById(id);
	}
} 